/**
 * 
 */
package com.Managers;


import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;

import android.support.v4.app.NotificationCompat;



/**
 * @author Chris
 * 
 */
public class NotificationManagerClass {

    public static int NOTIF_ID = 1;

    private Context context;

    public NotificationManagerClass(Context context) {

        super();
        this.context = context;
    }

    public void mostrarNotification(String name, String msg, Intent to, String url, int icon, boolean alert) {

        PendingIntent pi = PendingIntent.getActivity(context, 0, to, PendingIntent.FLAG_CANCEL_CURRENT);
        NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
        builder.setSmallIcon(icon);
        builder.setTicker(name + " " + msg);
        builder.setContentIntent(pi);
        builder.setContentText(msg);
        builder.setContentTitle(name);
    
        if (alert) {
            builder.setLights(Color.WHITE, 1500, 2000);
            builder.setDefaults(Notification.DEFAULT_SOUND);
            builder.setDefaults(Notification.DEFAULT_VIBRATE);
        }
        NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        mNotificationManager.notify(NOTIF_ID, builder.build());
    }

    public void showNotUploading(String title, String msg, Intent to, int icon) {

        PendingIntent pi = PendingIntent.getActivity(context, 0, to, PendingIntent.FLAG_CANCEL_CURRENT);
        NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
        builder.setSmallIcon(icon);
        builder.setTicker(title + " " + msg);
        builder.setContentIntent(pi);
        builder.setContentText(msg);
        builder.setContentTitle(title);

        NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        mNotificationManager.notify(NOTIF_ID, builder.build());
    }
}
